﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="KpiFormUserRec.aspx.cs" Inherits="kpi.KpiForm_user.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
    <asp:Label ID="Label_UserName" runat="server" Text="Label"></asp:Label>，请在此处更新您的KPI完成情况。</div>
<div>
    <br />
    <asp:GridView ID="GridView_KpiFormUserRec" runat="server" 
        DataSourceID="SqlDataSource_KpiFormUserRec" AutoGenerateColumns="False" 
        DataKeyNames="id" BackColor="White" BorderColor="#CC9966" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="GridView_UserKpiForm_RowDataBound" ShowFooter="True">
        <Columns>
            <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" 
                SortExpression="id" Visible="False" />
            <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                SortExpression="UserName" Visible="False" />
            <asp:BoundField DataField="u_kpi" HeaderText="关键绩效指标（KPI）" ReadOnly="True" 
                SortExpression="u_kpi" />
            <asp:BoundField DataField="u_kpi_std" HeaderText="考核标准" ReadOnly="True"
                SortExpression="u_kpi_std" />
            <asp:BoundField DataField="u_kpi_comm" HeaderText="KPI说明" ReadOnly="True"
                SortExpression="u_kpi_comm" />
            <asp:BoundField DataField="u_kpi_rat" HeaderText="权重" ReadOnly="True"
                SortExpression="u_kpi_rat" />
            <asp:BoundField DataField="u_kpi_fx" HeaderText="计算方式" ReadOnly="True"
                SortExpression="u_kpi_fx" />
           <%-- <asp:BoundField DataField="u_kpi_rec" HeaderText="自评得分" SortExpression="u_kpi_rec" />--%>
            <asp:BoundField DataField="uM_kpi_rec" HeaderText="uM_kpi_rec" ReadOnly="True"
                SortExpression="uM_kpi_rec" Visible="False" />
            <asp:BoundField DataField="u_kpi_ref" HeaderText="KPI完成数值/内容" SortExpression="u_kpi_ref" />
            <asp:BoundField DataField="u_kpi_done_comm" HeaderText="KPI完成情况说明" SortExpression="u_kpi_ref" />
            <asp:BoundField DataField="u_kpi_conf" HeaderText="u_kpi_conf" ReadOnly="True"
                SortExpression="u_kpi_conf" Visible="False" />
            <asp:CommandField ShowEditButton="True" />
        </Columns>
        <EmptyDataTemplate>
            您没有需要评分的KPI信息，查看KPI考评得分，请点击<a href="ShowKpiInfo.aspx">查看我的KPI考评得分</a>。
        </EmptyDataTemplate>
        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
        <RowStyle BackColor="White" ForeColor="#330099" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <SortedAscendingCellStyle BackColor="#FEFCEB" />
        <SortedAscendingHeaderStyle BackColor="#AF0101" />
        <SortedDescendingCellStyle BackColor="#F6F0C0" />
        <SortedDescendingHeaderStyle BackColor="#7E0000" />
    </asp:GridView>
    <asp:Button ID="Button_uConf" runat="server" Text="确认完成情况" OnClick="Button_uConf_Click" />
    <asp:SqlDataSource ID="SqlDataSource_KpiFormUserRec" runat="server" 
        ConnectionString="<%$ ConnectionStrings:kpi_forms_dbConnectionString %>"         
        
        SelectCommand="SELECT [id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [uM_kpi_rec], [u_kpi_ref], [u_kpi_conf],[u_kpi_done_comm] FROM [u_kpi_table] WHERE (([UserName] = @UserName) AND([u_kpi_ins_datetime]<DATEADD(MONTH, DATEDIFF(MONTH,0,getdate()), 0)) AND ([u_kpi_conf] = @u_kpi_conf))"
        UpdateCommand="UPDATE [u_kpi_table] SET [u_kpi_ref] = @u_kpi_ref,[u_kpi_done_comm] = @u_kpi_done_comm WHERE [id] = @original_id" 
        ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [u_kpi_table] WHERE [id] = @original_id AND [UserName] = @original_UserName AND [u_kpi] = @original_u_kpi AND [u_kpi_std] = @original_u_kpi_std AND [u_kpi_comm] = @original_u_kpi_comm AND [u_kpi_rat] = @original_u_kpi_rat AND [u_kpi_fx] = @original_u_kpi_fx AND [u_kpi_rec] = @original_u_kpi_rec AND [uM_kpi_rec] = @original_uM_kpi_rec AND [u_kpi_ref] = @original_u_kpi_ref AND [u_kpi_conf] = @original_u_kpi_conf" 
        InsertCommand="INSERT INTO [u_kpi_table] ([id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [u_kpi_rec], [uM_kpi_rec], [u_kpi_ref], [u_kpi_conf]) VALUES (@id, @UserName, @u_kpi, @u_kpi_std, @u_kpi_comm, @u_kpi_rat, @u_kpi_fx, @u_kpi_rec, @uM_kpi_rec, @u_kpi_ref, @u_kpi_conf)" 
        OldValuesParameterFormatString="original_{0}">
        <DeleteParameters>
            <asp:Parameter Name="original_id" Type="Object" />
            <asp:Parameter Name="original_UserName" Type="String" />
            <asp:Parameter Name="original_u_kpi" Type="String" />
            <asp:Parameter Name="original_u_kpi_std" Type="String" />
            <asp:Parameter Name="original_u_kpi_comm" Type="String" />
            <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
            <asp:Parameter Name="original_u_kpi_fx" Type="String" />
            <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
            <%--<asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />--%>
            <asp:Parameter Name="original_u_kpi_ref" Type="String" />
            <asp:Parameter Name="original_u_kpi_conf" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="id" Type="Object" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="u_kpi" Type="String" />
            <asp:Parameter Name="u_kpi_std" Type="String" />
            <asp:Parameter Name="u_kpi_comm" Type="String" />
            <asp:Parameter Name="u_kpi_rat" Type="Int32" />
            <asp:Parameter Name="u_kpi_fx" Type="String" />
            <asp:Parameter Name="u_kpi_rec" Type="Int32" />
            <%--<asp:Parameter Name="uM_kpi_rec" Type="Int32" />--%>
            <asp:Parameter Name="u_kpi_ref" Type="String" />
            <asp:Parameter Name="u_kpi_conf" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="Label_UserName" Name="UserName" 
                PropertyName="Text" Type="String" />
            <asp:Parameter DefaultValue="1" Name="u_kpi_conf" Type="String" />
            <%--<asp:Parameter DefaultValue="0" Name="u_kpi_doneconf" Type="String" />--%>
        </SelectParameters>
        <UpdateParameters>
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="u_kpi" Type="String" />
                <asp:Parameter Name="u_kpi_std" Type="String" />
                <asp:Parameter Name="u_kpi_comm" Type="String" />
                <asp:Parameter Name="u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="u_kpi_fx" Type="String" />
                <%--<asp:Parameter Name="u_kpi_rec" Type="Int32" />--%>
                <asp:Parameter Name="uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="u_kpi_ref" Type="String" />
                <asp:Parameter Name="u_kpi_conf" Type="String" />
            <asp:Parameter Name="u_kpi_done_comm" Type="String" />
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="original_UserName" Type="String" />
                <asp:Parameter Name="original_u_kpi" Type="String" />
                <asp:Parameter Name="original_u_kpi_std" Type="String" />
                <asp:Parameter Name="original_u_kpi_comm" Type="String" />
                <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_fx" Type="String" />
                <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_ref" Type="String" />
                <asp:Parameter Name="original_u_kpi_conf" Type="String" />
            <asp:Parameter Name="original_u_kpi_done_comm" Type="String" />
            </UpdateParameters>
    </asp:SqlDataSource>
</div>
</asp:Content>
